Include Channel Name in server log#206
Include Channel Name in server log#206NicoPiel wants to merge 24 commits intoOpenIntegrationEngine:mainfrom
Conversation
client/src/com/mirth/connect/plugins/serverlog/ServerLogPanel.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChain.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/plugins/serverlog/ArrayAppender.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChain.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/plugins/serverlog/ArrayAppender.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/plugins/serverlog/ServerLogProvider.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/server/util/javascript/JavaScriptTask.java
Outdated
Show resolved
Hide resolved
9fce32c to
3c94136
Compare
|
@mgaffigan Thoughts on the map implementation? Did you have this in mind when you suggested a map? |
Signed-off-by: Nico Piel <nicopiel@mailbox.org> Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org> Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org> Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org> Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nicopiel@mailbox.org> Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Changes the ArrayAppender to construct a ServerLogItem directly instead of passing individual log properties. The ServerLogProvider now accepts a ServerLogItem, extracts the log properties, adds the server ID and log ID, and then passes the log item to the log controller. This change simplifies the code and makes it more efficient by reducing the number of parameters passed and centralizing the creation of the ServerLogItem. Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Ensures that the ServerLogItem properties are initialized with default values when retrieving them from the context. This prevents null pointer exceptions or unexpected behavior when these properties are not explicitly set in the context. Signed-off-by: Nico Piel <nico.piel@hotmail.de>
2482499 to
53a85d9
Compare
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
a418b01 to
278d2b3
Compare
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
469b1c1 to
b1623c9
Compare
client/src/com/mirth/connect/plugins/serverlog/ServerLogClient.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChain.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Outdated
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Outdated
Show resolved
Hide resolved
server/src/com/mirth/connect/server/servlets/SwaggerExamplesServlet.java
Show resolved
Hide resolved
server/src/com/mirth/connect/server/util/javascript/JavaScriptTask.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChain.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Nico Piel <nico.piel@hotmail.de>
There was a problem hiding this comment.
Pull request overview
This PR adds channel name information to server logs by propagating channel context through Log4j's ThreadContext mechanism. The implementation spans three main components: server-side logging infrastructure, the Donkey engine threading model, and the client UI.
Key changes:
- Modified
ServerLogItemto store channel information in an attributes map with convenient getter/setter methods - Updated all channel-related thread entry points to populate
ThreadContextwith channel ID and name usingCloseableThreadContext - Enhanced the server log UI table to display a new "Channel" column
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| server/src/com/mirth/connect/server/util/javascript/JavaScriptTask.java | Added ThreadContext population with channel info in JavaScript task execution |
| server/src/com/mirth/connect/plugins/serverlog/ServerLogProvider.java | Updated method signature to accept attributes map for channel information |
| server/src/com/mirth/connect/plugins/serverlog/ServerLogItem.java | Added attributes map to store channel data with dedicated getter/setter methods |
| server/src/com/mirth/connect/plugins/serverlog/ArrayAppender.java | Modified to extract context data from Log4j events and pass to provider |
| donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java | Wrapped queue thread execution with ThreadContext for channel info |
| donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChainProvider.java | Added channelName field with getter/setter |
| donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationChain.java | Added ThreadContext population in chain execution threads |
| donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java | Updated to set channel name on chain providers and populate ThreadContext in dispatch/queue threads |
| client/src/com/mirth/connect/plugins/serverlog/ServerLogPanel.java | Added "Channel" column to server log table and adjusted column indices |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/Channel.java
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Show resolved
Hide resolved
donkey/src/main/java/com/mirth/connect/donkey/server/channel/DestinationConnector.java
Show resolved
Hide resolved
pacmano1
left a comment
There was a problem hiding this comment.
Firstly, I do like this the change!
However for those of us who already prepend channelName to log messages, IMHO this should be implemtned as an optional feature configurable by default to off via mirth.properties
@pacmano1, that would make this hard to discover for newcomers and the majority of users who don't log servername. There only seems to be a cosmetic problem if it is enabled by default, and a usability problem if disabled. Defaults should be based on best practice for the typical new user. |
Changelog:
Server:
ServerLogItemto includechannelName, updated constructor, getters/setters.ServerLogProviderto passchannelNametoServerLogItem.ArrayAppenderto extractchannelNameandchannelIdfrom Log4jThreadContext.JavaScriptTaskto populateThreadContextwith channel info.Donkey Engine:
Channelto populateThreadContextin dispatch and source queue threads.DestinationChainto populateThreadContextusing channel info.DestinationConnectorto populateThreadContextin queue threads.Client:
ServerLogPanelto add "Channel" column to the UI table.